<link rel="stylesheet" href="assets/common/plugins/umeditor/themes/default/css/umeditor.css">
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">添加首页数据</div>
                            </div>
                            <div class="am-form-group isshow" >
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">数据类型 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <select name="article[type]" data-am-selected="{btnSize: 'sm'}" class="isshow1">
                                            <option value="1"> logo位</option>
                                            <option value="2"> 广告位</option>
                                            <option value="3"> 通知信息</option>
                                            <option value="4"> 销售榜单</option>
                                    </select>
                                </div>
                            </div>
                            <div class="aaa">
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">名称 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="article[name]"
                                           value="" placeholder="请输入名称" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">标题 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <input type="text" class="tpl-form-input" name="article[title]"
                                           value="" placeholder="请输入标题" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">内容 </label>
                                <div class="am-u-sm-9 am-u-end">

                                    <textarea name="article[content]" id="conent" cols="10"  rows="6" class="form-control" data-rule="required"></textarea>
                                </div>
                            </div>
                            </div>
                            <div class="am-form-group quyus">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">图片 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div class="am-form-file">
                                        <div class="am-form-file">
                                            <button type="button"
                                                    class="upload-file5 am-btn am-btn-secondary am-radius">
                                                <i class="am-icon-cloud-upload"></i> 选择图片
                                            </button>
                                            <div class="uploader-list am-cf">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<!-- 图片文件列表模板 -->
<script id="tpl-file-item" type="text/template">
    {{ each list }}
    <div class="file-item">
        <a href="{{ $value.file_path }}" title="点击查看大图" target="_blank">
            <img src="{{ $value.file_path }}">
        </a>
        <input type="hidden" name="{{ name }}" value="{{ $value.file_id }}">
        <i class="iconfont icon-shanchu file-item-delete"></i>
    </div>
    {{ /each }}
</script>

<!-- 文件库弹窗 -->
{{include file="layouts/_template/file_library" /}}

<script src="assets/admin/plugins/umeditor/umeditor.config.js?v=<?= $version ?>"></script>
<script src="assets/admin/plugins/umeditor/umeditor.min.js"></script>
<script>
    $(function () {

        // 选择图片
        $('.upload-file5').selectImages({
            name: 'article[imageId]'
        });

        // 富文本编辑器
        UM.getEditor('container', {
            initialFrameWidth: 600,
            initialFrameHeight: 600
        });
        $('.isshow1').change(function(){
            var cs=$('.isshow1 option:selected').val();
            if(cs==3){
                $('.quyus').hide();
            }
            if(cs==2){
                $('.aaa').hide();
            }
        })
        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
